import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'

Vue.use(Vuex)

// 应用初始状态
const state = {
    merchantIcon: '',
    count: 10,
    token: '',
    merchantId: '',
    model: '',
    merchantName:'',
    roleTpye:null,

}

// 定义所需的 mutations
const mutations = {
    SETROLETYPE(state,roleTpye){
        state.roleTpye = roleTpye
    },
    SETMERCHANTNAME(state, merchantName) {
        state.merchantName = merchantName
    },
    SETICON(state, merchantIcon) {
        state.merchantIcon = merchantIcon
    },
    INCREMENT(state) {
        state.count++
    },
    DECREMENT(state) {
        state.count--
    },

    SETTOKEN(state, token) {
        state.token = token
    },
    SETMERCHANTID(state, merchantId) {
        state.merchantId = merchantId
    },
    SETMODEL(state, model) {
        state.model = model
    },

}

// 创建 store 实例
export default new Vuex.Store({
    actions,
    getters,
    state,
    mutations
})